package com.myspring.controller;

import com.github.pagehelper.Page;
import com.myspring.entity.User;
import com.myspring.service.MyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping(value = {"/mycontroller9"})
public class MyController9 {
    @Autowired
    MyService myService;

    @RequestMapping(value = "/mymethod9/{pageNum}")
    public ResponseEntity<Page<User>> queryAllUser(@PathVariable(value = "pageNum") Integer pageNum) throws  Exception{
        List<User> userList=this.myService.queryAllUser(pageNum);
            return new ResponseEntity<Page<User>>((Page<User>) userList, HttpStatus.OK);
    }
}
